package com.zzyl.controller.customer;

import com.zzyl.base.ResponseResult;
import com.zzyl.controller.BaseController;
import com.zzyl.utils.UserThreadLocal;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;

@RequestMapping("/customer/reservation")
@RestController
@Api(tags = "参观预约")
@Slf4j
public class ResevationController extends BaseController {
//    @Autowired
//    private JwtConfigProperties jwtConfigProperties;

    @GetMapping("/cancelled-count")
    @ApiOperation("查询当前用户的预约取消次数")
    public ResponseResult cancelledCount(HttpServletRequest request){
        //获取当前登录用户ID?
//        String token = request.getHeader(Constants.AUTHORIZATION);
//        Map<String, Object> claims = JwtUtil.parseJWT(jwtConfigProperties.getBase64EncodedSecretKey(), token);
//        Long userId = Long.valueOf(claims.get(Constants.JWT_USERID).toString());
        Long userId = UserThreadLocal.getUserId();
        log.info("获取到当前登录的用户ID为{}",userId);
        return success();
    }
}
